﻿using YDT_UserService.Domain.Entities;
using YDT_UserService.Domain.Enums;

namespace YDT_UserService.Domain.Interfaces
{
    /// <summary>
    /// 用户仓储接口 - 定义用户数据访问契约
    /// </summary>
    public interface IUserRepository
    {
        /// <summary>根据ID获取用户</summary>
        Task<User?> GetByIdAsync(Guid id);
        /// <summary>根据用户名获取用户</summary>
        Task<User?> GetByUserNameAsync(string userName);
        /// <summary>根据手机号获取用户</summary>
        Task<User?> GetByPhoneAsync(string phone);
        /// <summary>获取所有用户</summary>
        Task<IEnumerable<User>> GetAllAsync();
        /// <summary>根据状态获取用户</summary>
        Task<IEnumerable<User>> GetByStatusAsync(UserStatus status);
        /// <summary>分页获取用户</summary>
        Task<(IEnumerable<User> Users, int TotalCount)> GetPagedAsync(int pageIndex, int pageSize);
        /// <summary>添加用户</summary>
        Task AddAsync(User user);
        /// <summary>更新用户</summary>
        Task UpdateAsync(User user);
        /// <summary>删除用户</summary>
        Task DeleteAsync(Guid id);
        /// <summary>检查用户是否存在</summary>
        Task<bool> ExistsAsync(Guid id);
        /// <summary>检查用户名是否存在</summary>
        Task<bool> UserNameExistsAsync(string userName);
        /// <summary>检查手机号是否存在</summary>
        Task<bool> PhoneExistsAsync(string phone);
    }
}
